home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_100
/
193_01
/
cypher1.c
< prev
next >
Wrap
Text File
|
1985-11-13
|
640b
|
32 lines
/* cypher1.c Cypher module by F.A.Scacchitti
** 10/10/85
**
** Simple cypher module - encodes directly with user keys
**
*/
#include <stdio.h>
static int i, n, keylength;
cypher1(buffer, num, code) char *buffer, *code; int num;{
/*
** get keylength for each key
*/
keylength = 0;
while(code[keylength++] != NULL);
keylength--;
/*
** encrypt the file with each key
*/
printf("-encoding/decoding buffer\n");
for(i=0; i<=num; i++)
buffer[i] = buffer[i] ^ code[i % keylength];
}